package com.loooooo.pm2024.config;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;

public class BigIDListSerialize extends JsonSerializer<List<Long>> {


    @Override
    public void serialize(List<Long> value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        if (value != null) {
            jsonGenerator.writeObject(value.stream().map(x -> x.toString()).collect(Collectors.toList()));
            //jsonGenerator.writeString(StringUtils.join(value.stream().map(x -> "[" + x.toString() + "]").collect(Collectors.toList()), ","));
        }
    }
}